package cn.jbolt.ai.resource.function.controller;

import cn.jbolt.ai.resource.function.service.AiFunctionParamService;
import cn.jbolt.ai.resource.function.entity.AiFunctionParam;
import cn.jbolt.util.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * AI函数参数管理
 */
@Controller
@ResponseBody
@RequestMapping("/aiFunctionParam")
@Tag(name = "AI函数参数管理Controller")
public class AiFunctionParamController {

    @Autowired
    private AiFunctionParamService functionParamService;

    @Operation(summary = "根据ID获取AI函数参数信息", description = "根据ID获取AI函数参数信息")
    @GetMapping("/getById/{id}")
    public Result getById(@PathVariable Long id) {
        return functionParamService.getParamById(id);
    }

    @Operation(summary = "获取所有AI函数参数信息", description = "获取所有AI函数参数信息")
    @GetMapping("/list")
    public Result getList(@RequestParam(required = false) String keywords,Long functionId) {
        return functionParamService.getList(keywords,functionId);
    }


    @Operation(summary = "更新AI函数参数信息", description = "更新AI函数参数信息")
    @PostMapping("/update")
    public Result update(@RequestBody AiFunctionParam param) {
        return functionParamService.update(param);
    }



    @Operation(summary = "修改AI函数参数的是否必填状态", description = "修改AI函数参数的是否必填状态")
    @GetMapping("/toggleEnable/{id}")
    public Result toggleEnable(@PathVariable Long id) {
        return functionParamService.toggleEnable(id);
    }
}
